package com.spancer.usercenter.controller;

import com.spancer.usercenter.dao.user.UserMapper;
import com.spancer.usercenter.domain.entity.user.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * author by: mars
 * Date: 2019/10/20 9:14
 * Description:
 */
@RestController
public class TestController {

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private DiscoveryClient discoveryClient; // SpringCloud提供的

    @GetMapping("/save")
    public User saveUser() {
        User user = new User();
        user.setWxId("wx123321");
        user.setWxNickname("kiki");
        user.setAvatarUrl("xxx");
        user.setBonus(100);
        user.setCreateTime(new Date());
        user.setUpdateTime(new Date());
        this.userMapper.insertSelective(user);
        return user;
    }

    @GetMapping("/query")
    public User query(User user){
        return user;
    }

}
